/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package carstore.ui.models;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.text.DateFormat;

/**
 *
 * @author wuhao
 */
@Entity
@Table(name = "ORDER_INFO")
@XmlRootElement
@NamedQueries({
	@NamedQuery(name = "OrderInfo.findAll", query = "SELECT o FROM OrderInfo o"),
	@NamedQuery(name = "OrderInfo.findByOrderId", query = "SELECT o FROM OrderInfo o WHERE o.orderId = :orderId"),
	@NamedQuery(name = "OrderInfo.findByOrderTime", query = "SELECT o FROM OrderInfo o WHERE o.orderTime = :orderTime"),
	@NamedQuery(name = "OrderInfo.findByStatus", query = "SELECT o FROM OrderInfo o WHERE o.status = :status")})
public class OrderInfo implements Serializable {

	private static final long serialVersionUID = 1L;
	@Id
        @Column(name = "ORDER_ID")
	private BigInteger orderId;
	@Column(name = "ORDER_TIME")
        @Temporal(TemporalType.TIMESTAMP)
	private Date orderTime;
	@Column(name = "status")
	private String status;
	@Column(name = "store_id")
	private Integer storeId;
	@Column(name = "user_id")
	private Integer userId;
	@Column(name = "car_id")
	private Integer carID;

	/*
    private String storeName;
    private String carName;
    private String userName;
    private String factoryId;
    private String strOrderId;
    private String strOrderTime;
    private SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    */
	public OrderInfo() {
	}

	public OrderInfo(BigInteger orderId) {
		this.orderId = orderId;
       // this.strOrderId=orderId.toString();
	}

	/*
    public String getStrOrderTime(){return strOrderTime;}
    public String getStrOrderId(){return strOrderId;}
    public void setStrOrderId(String StrOrderId){this.strOrderId=StrOrderId;}

    public String getStoreName(){return storeName;}
    public void setStoreName(String StoreName){this.storeName=StoreName;}
    public String getCarName(){return carName;}
    public void setCarName(String CarName){this.carName=CarName;}
    public String getUserName(){return userName;}
    public void setUserName(String UserName){this.userName=UserName;}
    public String getFactoryId(){return factoryId;}
    public void setFactoryId(String FactoryId){this.factoryId=FactoryId;}
*/
	public BigInteger getOrderId() {
		return orderId;
	}

	public void setOrderId(BigInteger orderId) {
		this.orderId = orderId;
	}

	public Date getOrderTime() {
		return orderTime;
	}

	public void setOrderTime(Date orderTime) {
		this.orderTime = orderTime;
        //this.strOrderTime=formatter.format(orderTime);
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Integer getStoreId() {
		return storeId;
	}

	public void setStoreId(Integer storeId) {
		this.storeId = storeId;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public Integer getCarID() {
		return carID;
	}

	public void setCarID(Integer carID) {
		this.carID = carID;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (orderId != null ? orderId.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are not set
		if (!(object instanceof OrderInfo)) {
			return false;
		}
		OrderInfo other = (OrderInfo) object;
		if ((this.orderId == null && other.orderId != null) || (this.orderId != null && !this.orderId.equals(other.orderId))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "carstore.ui.models.OrderInfo[ orderId=" + orderId + " ]";
	}
	
}
